<?php

namespace App\Models\Shop;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
   protected $guarded = ['product_id'];

   //商品下有很多相册
   public function galleries()
   {
      return $this->hasMany(ProductGallery::class, 'product_id');
   }

   //商品属于分类
   public function category()
   {
      return $this->belongsTo(Category::class, 'category_id');
   }


   //订单有很多订单商品
   public function order_products()
   {
      return $this->hasMany(OrderProduct::class);
   }

}
